package view;

import java.awt.Graphics2D;
import java.awt.Point;
import java.util.ArrayList;


public abstract class Block implements Picture {

	/**
	 * main render point
	 */
	private Point point;
	/**
	 * vertex number
	 */
	private int ZId;
	
	public abstract void draw(Graphics2D g);
	
	public abstract void drawControlPoints(Graphics2D g);
	
	public abstract void drawZ(Graphics2D g);
	
	public abstract void cleanDraw(Graphics2D g);
	
	public abstract int getId();
	
	public abstract void setId(int id);
	
	public abstract boolean contains(Point point);
	
	public abstract boolean haveControlPoint(Point point);
	
	public abstract Point getControlPointByClosePoint(Point close);
	
	public abstract boolean isCausePoint(Point point);
	
	public abstract String toString();
	
	public boolean haveLine(PictureModel pictureModel){
		ArrayList<Line> lines = pictureModel.getLines();
		for(Line line:lines){
			if(this.equals(line.getCauseBlock()) || this.equals(line.getSecondBlock()))
				return true;
		}
		return false;
	}
	
	public boolean equals(Block block){
		if (block == this)
			return true;

		if (block == null)
			return false;
		return false;
	}
	
			
	public Point getPoint() {
		return point;
	}

	public void setPoint(Point point) {
		this.point = point;
	}

	public int getZId() {
		return ZId;
	}

	public void setZId(int ZId) {
		this.ZId = ZId;
	}

}
